﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace WebRole1
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "ItaraService" in both code and config file together.
    [ServiceContract]
    public interface ItaraService
    {
        [OperationContract]
        void DoWork();

        #region login
        #region token

        [OperationContract]
        string GetToken();

        [OperationContract]
        doctor DocUseService(string Key);

        [OperationContract]
        int PatientUseService(string Key);

        [OperationContract]
        bool DocHash(string HashStr, string UserName, int minutes);

        [OperationContract]
        bool PatientHash(string HashStr, string UserName, int minutes);

        [OperationContract]
        string Hash(string ToHash);
        #endregion
        #endregion

        #region CRUD for patient
        [OperationContract]
        int addNewPatient(string lastName, string firstName, DateTime dOB, string gender, string address1, string postalCode, string homePhone, string mobile, string email, int doctor, string imgPath, string nric, DateTime adminDate);

        [OperationContract]
        bool updatePatient(int uid, string lastName, string firstName, DateTime dOB, string gender, string address1, string postalCode, string homePhone, string mobile, string email, string imgPath, string nric, DateTime adminDate);

        [OperationContract]
        List<patient> retrieveAllOwnPatients(int docname);

        [OperationContract]
        int retrieveNumofOwnPatients(string docname);

        [OperationContract]
        patient retrievePatient(int uid);

        [OperationContract]
        List<patient> searchPatient(string toSearch, int doctorID);
        #endregion

        # region faceImg

        [OperationContract]
        string uploadFaceImage(string fileName, byte[] fileBytes);

        [OperationContract]
        string updateFaceImage(string fileName, byte[] fileBytes);

        [OperationContract]
        byte[] searchAndretrieveImage(string txtSearch);

        [OperationContract]
        byte[] retrieveImage(string URL);
        # endregion

        #region #region CRUD for patient_exe
        [OperationContract]
        int retrieveExeIDAssignedtoPatient(int exe, int patient, DateTime dateassigned);

        [OperationContract]
        List<EXE> retrieveGameAssignedtoPatient(int patientID);

        [OperationContract]
        bool deleteExeAssignedtoPatient(int uid);

        [OperationContract]
        bool createExeAssignedtoPatient(int patientID, List<EXE> exeList);

        [OperationContract]
        int assignedGametoPatient(int patientID, int exeID);

        [OperationContract]
        bool unassignedGameToPatient(int patientID, int exeID);
        #endregion

        #region retrieve_patient_exe_custKey

        [OperationContract]
        bool createPatientExeCustkey(List<KeyValuePair<string, string>> settingsList, int patient_exe_id);

        [OperationContract]
        List<KeyValuePair<string, string>> retrieve_patient_exe_custKey(int patient_exe_id);
        #endregion

        # region CRUD for exe
        [OperationContract]
        bool createEXE(string name, string path, string desc, int exeType, List<string> custKey);

        [OperationContract]
        List<EXE> retrieveAllEXE();

        [OperationContract]
        List<EXE> retrieveAllTreatment();

        [OperationContract]
        List<EXE> retrieveAllAssessment();

        [OperationContract]
        List<EXE> retrieveAllEXEofExeType(int exeType);

        [OperationContract]
        List<EXE> retrieveAllExeOfExeType(int exeType, int joint);

        [OperationContract]
        EXE retrieveEXE(int exeID);

        [OperationContract]
        List<string> retrieveTag(int exeID);

        [OperationContract]
        List<int> retrieveExeIDofTag(int joint);

        [OperationContract]
        List<EXE> retrieveExeofTag(int joint);

        [OperationContract]
        List<stage> retrieveExeStage(int exeID);

        [OperationContract]
        List<string> retrieve_exe_custKey(int exeID);

        [OperationContract]
        List<EXE> searchTreatment(string toSearch);

        [OperationContract]
        List<EXE> searchAssessment(string toSearch);

        #endregion

        # region CRUD stage
        [OperationContract]
        string retrieve_stageName(int stageID);
        #endregion

        #region CRUD gameplay
        [OperationContract]
        bool createNewGamePlay(int sessionID, string joint, string gameKey, string gameValue);

        [OperationContract]
        List<gamePlay> retrieveAllGamePlay();

        [OperationContract]
        List<gamePlay> retrieveAllGamePlayofSession(int sessionID);

        [OperationContract]
        gamePlay retrieveGamePlay(int gamePlayID);

        [OperationContract]
        List<KeyValuePair<string, string>> getOldestUID(int exeID, int patientID);

        [OperationContract]
        List<gamePlay> getMaxMinAngle(int patientID);
        #endregion

        # region CRUD for session
        [OperationContract]
        int createNewSession(int patientID, int exeID);

        [OperationContract]
        int retrieveMostRecentSessionIDOfPatientofExe(int patientID, int exeID);

        [OperationContract]
        List<session> retrieveSessionOfPatient(int patientID);

        [OperationContract]
        List<session> retrieveSessionOfPatientofExe(int patientID, int exeID);

        [OperationContract]
        List<session> retrieveSession(int sessionID);

        [OperationContract]
        DateTime retrieveLatestAssessmentDate(int patientID);

        [OperationContract]
        DateTime retrieveLatestGamePlayDate(int patientID);
        #endregion

        # region CRUD for Tag
        [OperationContract]
        string retrieveJointName(string jointID);
        #endregion

        #region CRUD for problem
        [OperationContract]
        int addAndUpdateJointProblem(int jointID, int patientID, int severity);

        [OperationContract]
        bool removeJointProblem(int jointID, int patientID);

        #endregion

        #region score
        #region personal score
        [OperationContract]
        int retrievePersonalHighScore(int patientID, int exeID, int difficulty);

        [OperationContract]
        List<highScore> retrieveHighScore(int exeID, int difficulty);
        #endregion
        #endregion

        #region Mobile APP
        [OperationContract]
        List<patientM> retrieveAllOwnPatientsM(int docID);

        [OperationContract]
        doctor doctorLoginM(string username, string password);

        [OperationContract]
        doctor retrievePatientDoctor(int uid);

        [OperationContract]
        patientM patientLoginM(string username, string password);
        
        [OperationContract]
        patientM retrievePatientM(int uid);

        [OperationContract]
        List<gamePlay> getAllMaxMinAngleM(int patientID);

        [OperationContract]
        doctor getDoctor(int uid);

        [OperationContract]
        List<int> retrieveSessionOfPatientEXE10M(int patientID);
        #endregion

        #region teleRehab
        [OperationContract]
        List<KeyValuePair<string, string>> getLatestUID(int exeID, int patientID);

        [OperationContract]
        List<double> getLatestAngle(int exeID, int patientID, int jointID, string axis);

        [OperationContract]
        void saveScreenShot(int patientID, int exeID, string fileName);

        [OperationContract]
        int getPatientUID(string username);

        [OperationContract]
        List<byte[]> readScreenShot(int patientID);
        #endregion

        #region SMS
        [OperationContract]
        void smsTechnicalSupport(int patientID, string msg);

        [OperationContract]
        void smsDoctor(int patientID, string msg);
        #endregion
    }
}